package com.warrior.superdata.handler;

import com.warrior.superdata.constants.CommonConstant;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @ClassName: EsHandler.java
 * @date: 2022/6/24 17:15
 * @author xujian
 */
@Component
@Slf4j
public class EsHandler {

    public UpdateRequest toUpdateIndexRequest(String jsonStr, String indexName, String id) {
        return new UpdateRequest(indexName, CommonConstant.ES_DOC, id).doc(jsonStr, XContentType.JSON);
    }

}
